﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using IdentityMine.Windows.Eventing;
using System.Diagnostics;

namespace SilverlightApplication1
{
	public partial class UserControl1 : UserControl
	{
		public UserControl1()
		{
			// Required to initialize variables
			InitializeComponent();
		}
		
#if SILVERLIGHT
        public delegate void HoverEnterRoutedEventHandler(object sender, RoutedEventArgsEx e);
        public static readonly RoutedEventEx HoverEnterEvent = EventManagerEx.RegisterRoutedEvent("HoverEnter", RoutingStrategy.Bubble, typeof(HoverEnterRoutedEventHandler), typeof(UserControl1));
#else
        public delegate void HoverEnterRoutedEventHandler(object sender, RoutedEventArgsEx e);
        public static readonly RoutedEvent HoverEnterEvent = EventManager.RegisterRoutedEvent("HoverEnter", RoutingStrategy.Bubble, typeof(HoverEnterRoutedEventHandler), typeof(UserControl1));
#endif

        public static void AddHoverEnterHandler(DependencyObject o, HoverEnterRoutedEventHandler handler)
        {
            ((UIElement)o).AddHandlerEx(HoverEnterEvent, handler);
        }

        public static void RemoveHoverEnterHandler(DependencyObject o, HoverEnterRoutedEventHandler handler)
        {
            ((UIElement)o).RemoveHandlerEx(HoverEnterEvent, handler);
        }

        private void OnClick(object sender, System.Windows.RoutedEventArgs e)
        {
			tbFred.Text = "Clicked";
        	this.RaiseEventEx(new RoutedEventArgsEx(HoverEnterEvent));
        }
	}
}